#include "drawer.h"
#include <QGroupBox>
#include <QVBoxLayout>




Drawer::Drawer(QWidget *parent,Qt::WindowFlags f):QToolBox(parent,f)
{
    setWindowTitle(tr("楼上楼下"));
    setWindowIcon(QPixmap(":/images/1.jpg"));

    //头像按钮 点击头像进入对话框
    toolBtn1 = new QToolButton;
    toolBtn1->setText(tr("班伟博"));
    toolBtn1->setIcon(QPixmap(":/images/1.jpg"));
    toolBtn1->setIconSize(QSize(100,100));
    toolBtn1->setAutoRaise(true);
    toolBtn1->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn1,SIGNAL(clicked(bool)),this,SLOT(showChatWidget1()));

    toolBtn2 = new QToolButton;
    toolBtn2->setText("徐文侠");
    toolBtn2->setIcon(QPixmap(":/images/2.jpg"));
    toolBtn2->setIconSize(QSize(100,100));
    toolBtn2->setAutoRaise(true);
    toolBtn2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn2,SIGNAL(clicked(bool)),this,SLOT(showChatWidget2()));



    toolBtn3 = new QToolButton;
    toolBtn3->setText("许少凯");
    toolBtn3->setIcon(QPixmap(":/images/3.jpg"));
    toolBtn3->setIconSize(QSize(100,100));
    //toolBtn3->setIconSize(QPixmap(":/images/3.jpg").size());
    toolBtn3->setAutoRaise(true);
    toolBtn3->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn3,SIGNAL(clicked(bool)),this,SLOT(showChatWidget3()));


    toolBtn4 = new QToolButton;
    toolBtn4->setText("王海涛");
    toolBtn4->setIcon(QPixmap(":/images/4.jpg"));
    toolBtn4->setIconSize(QSize(100,100));
    //toolBtn4->setIconSize(QPixmap(":/images/4.jpg").size()/2);
    toolBtn4->setAutoRaise(true);
    toolBtn4->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn4,SIGNAL(clicked(bool)),this,SLOT(showChatWidget4()));



    toolBtn5 = new QToolButton;
    toolBtn5->setText("张强");
    toolBtn5->setIcon(QPixmap(":/images/5.jpg"));
    toolBtn5->setIconSize(QSize(100,100));
    //toolBtn5->setIconSize(QPixmap(":/images/5.jpg").size());
    toolBtn5->setAutoRaise(true);
    toolBtn5->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn5,SIGNAL(clicked(bool)),this,SLOT(showChatWidget5()));


    toolBtn6 = new QToolButton;
    toolBtn6->setText("秦江");
    toolBtn6->setIcon(QPixmap(":/images/6.jpg"));
    toolBtn6->setIconSize(QSize(100,100));
    //toolBtn6->setIconSize(QPixmap(":/images/6.jpg").size());
    toolBtn6->setAutoRaise(true);
    toolBtn6->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn6,SIGNAL(clicked(bool)),this,SLOT(showChatWidget6()));



    toolBtn7 = new QToolButton;
    toolBtn7->setText("夏俊波");
    toolBtn7->setIcon(QPixmap(":/images/7.jpg"));
    toolBtn7->setIconSize(QSize(100,100));
    //toolBtn7->setIconSize(QPixmap(":/images/7.jpg").size()/2);
    toolBtn7->setAutoRaise(true);
    toolBtn7->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn7,SIGNAL(clicked(bool)),this,SLOT(showChatWidget7()));

    toolBtn8 = new QToolButton;
    toolBtn8->setText("杨爽");
    toolBtn8->setIcon(QPixmap(":/images/8.jpg"));
    toolBtn8->setIconSize(QSize(100,100));
    //toolBtn8->setIconSize(QPixmap(":/images/8.jpg").size()/2);
    toolBtn8->setAutoRaise(true);
    toolBtn8->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    connect(toolBtn8,SIGNAL(clicked(bool)),this,SLOT(showChatWidget8()));

    QGroupBox *groupBox = new QGroupBox;
    QVBoxLayout *layout = new QVBoxLayout(groupBox);
    layout->setMargin(20);
    layout->setAlignment(Qt::AlignLeft);
    layout->addWidget(toolBtn1);
    layout->addWidget(toolBtn2);
    layout->addWidget(toolBtn3);
    layout->addWidget(toolBtn4);
    layout->addWidget(toolBtn5);
    layout->addWidget(toolBtn6);
    layout->addWidget(toolBtn7);
    layout->addWidget(toolBtn8);

    layout->addStretch();
    this->addItem((QWidget *)groupBox,tr("群成员"));
}

void Drawer::showChatWidget1()
{
    charWidget1 = new Widget(0,toolBtn1->text());
    charWidget1->setWindowTitle(toolBtn1->text());
    charWidget1->setWindowIcon(toolBtn1->icon());
    charWidget1->show();
}

void Drawer::showChatWidget2()
{
    charWidget2 = new Widget(0,toolBtn2->text());
    charWidget2->setWindowTitle(toolBtn2->text());
    charWidget2->setWindowIcon(toolBtn2->icon());
    charWidget2->show();
}

void Drawer::showChatWidget3()
{
    charWidget3 = new Widget(0,toolBtn3->text());
    charWidget3->setWindowTitle(toolBtn3->text());
    charWidget3->setWindowIcon(toolBtn3->icon());
    charWidget3->show();
}

void Drawer::showChatWidget4()
{
    charWidget4 = new Widget(0,toolBtn4->text());
    charWidget4->setWindowTitle(toolBtn4->text());
    charWidget4->setWindowIcon(toolBtn4->icon());
    charWidget4->show();
}

void Drawer::showChatWidget5()
{
    charWidget5 = new Widget(0,toolBtn5->text());
    charWidget5->setWindowTitle(toolBtn5->text());
    charWidget5->setWindowIcon(toolBtn5->icon());
    charWidget5->show();
}

void Drawer::showChatWidget6()
{
    charWidget6 = new Widget(0,toolBtn6->text());
    charWidget6->setWindowTitle(toolBtn6->text());
    charWidget6->setWindowIcon(toolBtn6->icon());
    charWidget6->show();
}

void Drawer::showChatWidget7()
{
    charWidget7 = new Widget(0,toolBtn7->text());
    charWidget7->setWindowTitle(toolBtn7->text());
    charWidget7->setWindowIcon(toolBtn7->icon());
    charWidget7->show();
}

void Drawer::showChatWidget8()
{
    charWidget8 = new Widget(0,toolBtn8->text());
    charWidget8->setWindowTitle(toolBtn8->text());
    charWidget8->setWindowIcon(toolBtn8->icon());
    charWidget8->show();
}
